<template>
  <div>
    <van-collapse
      v-model="activeName"
      accordion
    >
      <van-collapse-item
        title="基本信息"
        name="1"
        icon="coupon-o"
      >
        <template>
          <div id="divTop">
            <van-row>
              <van-col span="7">
                <span class="spanTitle">天气情况：</span>
              </van-col>
              <van-col span="17"><span class="spanValue"> {{ form.WeatherName }}</span></van-col>
            </van-row>
            <van-row>
              <van-col span="7">
                <span class="spanTitle">日期：</span>
              </van-col>
              <van-col span="17"><span class="spanValue">{{
                  form.MettingDate | formatDate
                }}</span></van-col>
            </van-row>
            <van-row>
              <van-col span="7">
                <span class="spanTitle">班次：</span>
              </van-col>
              <van-col span="17">
                <span class="spanValue">{{ form.WorkFrequencyName }}</span>
              </van-col>
            </van-row>
            <van-row>
              <van-col span="7">
                <span class="spanTitle">班长：</span>
              </van-col>
              <van-col span="17">
                <span class="spanValue">{{ form.Monitor}}</span>
              </van-col>
            </van-row>
            <van-row>
              <van-col span="7">
                <span class="spanTitle">轮值安全员：</span>
              </van-col>
              <van-col span="17">
                <span class="spanValue">{{ form.DutyOfficer}}</span>
              </van-col>
            </van-row>
          </div>
        </template>
      </van-collapse-item>
      <van-collapse-item
        title="作业风险分析"
        name="2"
        icon="cluster-o"
      >
        <template v-for="(item1, index1) in form.Details">
          <div
            class="spanValue"
            v-bind:key="index1"
          >
            {{ item1.RiskTypeName }}：{{ item1.Description }}</div>
        </template>
      </van-collapse-item>
      <van-collapse-item
        title="培训内容"
        name="4"
        icon="cluster-o"
      >
        <template>
          <eagle-checkgroup
            v-model="TrainingContent"
            :dataSource="form.TrainingContentList"
            :option="{label:'Name',value:'ID'}"
            direction="horizontal"
            @change="TrainingContentChange"
            class="input_text"
            readonly
          ></eagle-checkgroup>
        </template>
      </van-collapse-item>
      <van-collapse-item
        title="其他注意事项"
        name="3"
        icon="info-o"
      >
        <template v-for="(item, index) in form.Details2">
          <van-row v-bind:key="item.SEQ">
            <van-col span="1"><span class="spanTitle">{{ index + 1 }}、</span></van-col>
            <van-col span="23">
              <div
                class="spanValue"
                v-bind:key="index"
              >
                {{ item.Description }}</div>
            </van-col>
          </van-row>
          <van-row
            v-bind:key="item.SEQ"
            v-if="item.Attachs"
          >
            <van-col span="1"><span class="spanTitle"></span></van-col>
            <van-col span="23">
              <eagle-image-preview
                class="mt-10"
                :images="item.Attachs"
              >
              </eagle-image-preview>
            </van-col>
          </van-row>
        </template>
      </van-collapse-item>
      <!-- <van-collapse-item title="出勤员工" name="4" icon="friends-o">
        <van-row>
          <van-col>
            <span class="spanValue">{{ form.AttendantsChn }}</span>
          </van-col>
        </van-row>
      </van-collapse-item> -->
      <van-collapse-item
        title="员工状态"
        name="5"
        icon="user-circle-o"
      >
        <van-row>
          <van-col span="17"> <span style="color: #323233; line-height: 28px">员工有无喝酒</span></van-col>
          <van-col span="7">
            <van-radio-group
              direction="horizontal"
              disabled
              v-model="form.IsDrinkAlcohol"
            >
              <van-radio
                v-for="item in whetherFTList"
                v-bind:name="item.ID"
                v-bind:key="item.ID"
              >{{ item.Name }}</van-radio>
            </van-radio-group>
          </van-col>
        </van-row>
        <van-row v-show="form.IsDrinkAlcohol == 'Y'">
          <van-col span="17"><span style="color: #323233; line-height: 28px">情况描述：</span></van-col>
          <van-col span="7">
            <span class="spanValue">{{ form.AlcoholDescription }}</span>
          </van-col>
        </van-row>
        <van-row v-show="form.IsDrinkAlcohol == 'Y'">
          <van-col span="17"><span style="color: #323233; line-height: 28px">处理措施：</span></van-col>
          <van-col span="7">
            <span class="spanValue">{{ form.AlcoholHandle }}</span>
          </van-col>
        </van-row>
        <van-row>
          <van-col span="10"> <span style="color: #323233; line-height: 28px">员工状态有无不佳</span></van-col>
          <van-col span="14">
            <van-radio-group
              direction="horizontal"
              v-model="form.IsMentality"
              disabled
            >
              <van-radio
                v-for="item in whetherFTList"
                v-bind:name="item.ID"
                v-bind:key="item.ID"
              >{{ item.Name }}</van-radio>
            </van-radio-group>
          </van-col>
        </van-row>
        <van-row v-show="form.IsMentality == 'Y'">
          <van-col span="10"><span style="color: #323233; line-height: 28px">情况描述：</span></van-col>
          <van-col span="14">
            <span class="spanValue">{{ form.MentalityDescription }}</span>
          </van-col>
        </van-row>
        <van-row v-show="form.IsMentality == 'Y'">
          <van-col span="10"><span style="color: #323233; line-height: 28px">处理措施：</span></van-col>
          <van-col span="14">
            <span class="spanValue">{{ form.MentalityHandle }}</span>
          </van-col>
        </van-row>
        <van-row>
          <van-col span="10">
            <span style="color: #323233; line-height: 28px">员工劳动防护用品穿戴有无不符合要求</span>
          </van-col>
          <van-col span="14">
            <van-radio-group
              direction="horizontal"
              v-model="form.IsWearStandard"
              disabled
            >
              <van-radio
                v-for="item in whetherFTList"
                v-bind:name="item.ID"
                v-bind:key="item.ID"
              >{{ item.Name }}</van-radio>
            </van-radio-group>
          </van-col>
        </van-row>
      </van-collapse-item>
      <van-collapse-item
        title="每日六问"
        name="6"
        icon="question-o"
      >
        <template>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">安全生产工作我重视了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                v-model="form.IsSafeJob"
                direction="horizontal"
                disabled
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">安全责任我履职尽责了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                direction="horizontal"
                disabled
                v-model="form.IsSafeResponsibility"
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">安全法规制度我遵守了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                v-model="form.IsSafeLaw"
                direction="horizontal"
                disabled
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">集团领导的要求，我做到了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                v-model="form.IsGroupRequire"
                direction="horizontal"
                disabled
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">我负责的领域，安全检查和隐患排除到位了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                v-model="form.IsResponsibilityArea"
                direction="horizontal"
                disabled
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
          <van-row>
            <van-col span="16">
              <span style="color: #c03131; padding-left: 10px">*</span>
              <span style="color: #323233; line-height: 28px">安全生产事故教训我吸取了吗？</span>
            </van-col>
            <van-col span="8">
              <van-radio-group
                v-model="form.IsSafeProduction"
                direction="horizontal"
                disabled
              >
                <van-radio
                  v-for="item in WhetherYNList"
                  v-bind:name="item.ID"
                  v-bind:key="item.ID"
                >{{ item.Name }}</van-radio>
              </van-radio-group>
            </van-col>
          </van-row>
        </template>
      </van-collapse-item>

      <van-collapse-item
        title="班组成员签名"
        name="7"
        icon="notes-o"
      >
        <template>
          <van-row style="background-color: #fff">
            <van-col span="8"><br /><br />
              <span
                style="margin-left: 5px"
                class="spanTitle"
              >会议现场照片</span>
            </van-col>
            <van-col span="16">
              <eagle-image-preview
                class="mt-10"
                :images="form.MettingPicture"
              >
              </eagle-image-preview>
            </van-col>
          </van-row>
          <van-row style="background-color: #fff">
            <van-col span="8"><br /><br />
              <span
                style="margin-left: 5px"
                class="spanTitle"
              >轮值安全员照片</span>
            </van-col>
            <van-col span="16">
              <eagle-image-preview
                class="mt-10"
                :images="form.SafePeoplePicture"
              >
              </eagle-image-preview>
            </van-col>
          </van-row>
          <van-row style="background-color: #fff">
            <van-col span="24">
              <div style="margin-left: 5px; margin-top: 15px">
                <van-checkbox
                  v-model="form.IsAgree == '1'"
                  disabled
                ><span class="spanValue">本人已接受上述培训教育并明白其详细内容</span></van-checkbox>
              </div>
            </van-col>
          </van-row>
          <van-row style="background-color: #fff">
            <van-col span="8"><br /><br />
              <span
                style="margin-left: 5px"
                class="spanTitle"
              >班组成员签名</span>
            </van-col>
            <van-col span="16">
              <eagle-image-preview
                class="mt-10"
                :images="form.UserSign"
              >
              </eagle-image-preview>
            </van-col>
          </van-row>
        </template>
      </van-collapse-item>
    </van-collapse>
    <van-overlay :show="showImg">
      <div
        class="imageShow"
        @click="showImg = false"
      >
        <van-image
          width="100%"
          :src="imagePath"
        />
      </div>
    </van-overlay>
  </div>
</template>
<script>
import { gxPreWorkMettingDetail, preWorkMettingInitNewEntity } from "@/api/gx";

export default {
  data() {
    return {
      showImg: false,
      TrainingContent: [],
      imagePath: "",
      baseUrl: process.env.VUE_APP_BASE_API,
      imgUrlList: [],
      id: this.$route.query.id,
      autoSize: { minRows: 1 },
      form: {},
      activeName: "1",
      whetherFTList: [],
      WhetherYNList: [],
    };
  },
  created() {
    this.preWorkMettingInitNewEntity();
  },
  methods: {
    getDetail() {
      var me = this;
      let params = { id: this.id };
      gxPreWorkMettingDetail(params).then((res) => {
        me.form = res.data;
        me.imgUrlList = (me.form.UserSign || "").split(";");
        this.TrainingContent = me.form.TrainingContent.split(",");
      });
    },
    preWorkMettingInitNewEntity() {
      var vm = this;
      preWorkMettingInitNewEntity(this.parentID).then((res) => {
        var tempData = res.data;
        vm.whetherFTList = tempData.WhetherFTList;
        vm.WhetherYNList = tempData.WhetherYNList;
        vm.getDetail();
      });
    },
  },
};
</script>
<style lang="less">
.imageShow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.van-image {
  background: #fff !important;
}
#divTop span {
  line-height: 28px;
}
.spanTitle {
  font-size: 14px;
  color: #323233;
  width: 80px;
  line-height: 28px;
}
.spanValue {
  font-size: 14px;
  color: #323233;
  line-height: 28px;
}
#divPicture .van-cell__value {
  min-width: 70%;
}
</style>